import React from 'react';
import { inject, observer } from 'mobx-react';
import './index.scss';

import ImageLoader from './node_modules/@src/imgs/ImageLoader'

//共用才提取 
@inject('oneStore')
@observer
class OneView extends React.Component {

    constructor(props) {
        super(props);
        this.state = {

            userList: []

        };
    }

    componentWillMount() {
        this.props.oneStore.getEntryList();
    }

    //入口点击事件
    handlerEntryEachClick = (item) => {

        if (item.target == '_blank') {
            window.open(item.pathTo);
        } else {
            window.location.href = item.pathTo;
        }
    }

    render() {
        return (
            <div className="page_view_container one-view">

                <div className="entry_wrap">
                    {
                        this.props.oneStore.entryList && this.props.oneStore.entryList.map((item, index) => {
                            return (
                                <div kye={index} className="entry_each" onClick={() => { this.handlerEntryEachClick(item) }}>
                                    <img src={ImageLoader[item.imgUrl]} />
                                    <div className="entry_each_title">{item.title}</div>
                                </div>
                            )
                        })
                    }
                </div>



            </div>
        );
    }
}
export default OneView;